import java.util.ArrayList;
import java.util.List;

public class PrimeFactors {
    List<Integer> factors = new ArrayList<Integer>();
    List<Integer> primeFactors = new ArrayList<Integer>();

    public boolean checkIfNumberIsPrime(int givenNumber) {
        if (givenNumber == 1 || givenNumber == 0)
            return false;
        else
            for (int count = 2; count * count <= givenNumber; count++) {

                if (givenNumber % count == 0)
                    return false;

            }
        return true;
    }


    public List<Integer> generateFactorsOfGivenNumber(int givenNumber) {

        List<Integer> factors = new ArrayList<Integer>();
        for (int counter = 1; counter <= givenNumber / 2; counter++) {

            if (givenNumber % counter == 0)
                factors.add(counter);

        }
        return factors;

    }

    public List<Integer> generatePrimeFactors(int givenNumber) {

        factors = generateFactorsOfGivenNumber(givenNumber);
        for (Integer factor : factors) {
            if (checkIfNumberIsPrime(factor))
                primeFactors.add(factor);
        }
        return primeFactors;

    }

}
